package org.proyectosinapsis.Sinapsis;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.PopupMenu;

/**
 * User: Alexander Simoes
 * Company: CoralVision Systems
 * Date: 9/25/12
 */
public class PatientHomeActivity extends Activity {

	private String patientPID = "10000000";  //ToDo: Change this
	public final static String USER_OPTION = "org.proyectosinapsis.Sinapsis.OPTION";
	public final static String USER_PID = "org.proyectosinapsis.Sinapsis.PID";
	public final static int OPT_PERS_DATA = 1;
	public final static int OPT_BACK_FAM = 2;
	public final static int OPT_BACK_PER = 3;
	public final static int OPT_BACK_PSI = 4;
	public final static int OPT_PHYS = 5;
	public final static int OPT_SOAP = 6;
	public final static int OPT_IMMU = 7;
	public final static int OPT_LAB = 8;

	public void onCreate(Bundle savedInstanceState) {    //ToDo: listener for back logo
		super.onCreate(savedInstanceState);
		setContentView(R.layout.patient_home);
	}

	public void onClickPersonalData(View view) {
		Intent intent = new Intent(this, PatientShowActivity.class);
		intent.putExtra(USER_OPTION,OPT_PERS_DATA);
		intent.putExtra(USER_PID, patientPID);
		startActivity(intent);
	}

	public void onClickBackground(View view) {

		final Intent intent = new Intent(this, PatientShowActivity.class);
		intent.putExtra(USER_PID, patientPID);


		//Ask the user which background with a PopMenu
		PopupMenu popupMenu = new PopupMenu(this, view);
		popupMenu.inflate(R.menu.immu_popmenu);
		popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
			@Override
		    public boolean onMenuItemClick(MenuItem item) {

				switch (item.getItemId()) {
					case R.id.menu1:
						intent.putExtra(USER_OPTION,OPT_BACK_FAM);
						startActivity(intent);
						return true;
					case R.id.menu2:
						intent.putExtra(USER_OPTION,OPT_BACK_PER);
						startActivity(intent);
						return true;
					case R.id.menu3:
						intent.putExtra(USER_OPTION,OPT_BACK_PSI);
						startActivity(intent);
						return true;
					default:
						return false;
				}
			}
		});
		popupMenu.show();
	}
	/*
	public void patientPhysical(View view) {
		Intent intent = new Intent(this, PatientShowActivity.class);
		intent.putExtra(USER_OPTION,"5");
		intent.putExtra(USER_PID, patientPID);
		startActivity(intent);
	}
    */

	public void patientImmu(View view) {
		Intent intent = new Intent(this, PatientShowActivity.class);
		intent.putExtra(USER_OPTION,OPT_IMMU);
		intent.putExtra(USER_PID, patientPID);
		startActivity(intent);
	}

}